import cv2
img =cv2.imread(r'C:\Users\Administrator\Desktop\puppy.jpg')
if img is not None and len(img.shape)==3:
    print('img.shape:',img.shape)
    def show_img(title, img, delay=-1):
        cv2.imshow(title, img)
        if delay == -1:
            cv2.waitKey(0)
        else:
            cv2.waitKey(delay)
    show_img('img',img,-1)
    if img.shape[2]==3:
        b,g,r=cv2.split(img)
        show_img('b',b,-1)
        show_img('g',g,-1)
        show_img('r',r,-1)
    elif img.shape[2]==4:
        b,g,r,a=cv2.split(img)
        show_img('b',b, -1)
        show_img('g',g, -1)
        show_img('r',r, -1)
        show_img('a',a,-1)
cv2.waitKey()
cv2.destroyAllWindows()